﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ThanhTu.GNCMedia.KQXS.DataAccess.DAL;
using ThanhTu.GNCMedia.KQXS.DataAccess.BL;

namespace WebUI
{
    public partial class ThongKe : System.Web.UI.Page
    {
        ResultLotteryBL vResultLotteryBL;
        ProvinceBL vProvinceBL;
        protected void Page_Load(object sender, EventArgs e)
        {
            vProvinceBL = new ProvinceBL();
            ddltinhthanh.DataSource = vProvinceBL.selectadd();
            ddltinhthanh.DataTextField = "princeName";
            ddltinhthanh.DataValueField = "provinceID";
            ddltinhthanh.DataBind();

            if (!Page.IsPostBack)
            {
                Panel_ketqua.Visible = false;
            }
        }

        protected void tbnphantich_Click(object sender, EventArgs e)
        {

            vResultLotteryBL = new ResultLotteryBL();

            string thongke = txtphantich.Text;
            if (thongke.Trim().Equals("") || thongke.Length != 2)
            {
                return;
            }
            if (txttungay.Text.Trim().Equals(""))
            {
                return;
            }
            if (txttungay.Text.Trim().Equals(""))
            {
                return;
            }
            Panel_ketqua.Visible = true;
            lblso.Text = thongke;
            lbltinh.Text = ddltinhthanh.SelectedItem.ToString();
            lbltu.Text = txttungay.Text;
            lblden.Text = txtdenngay.Text;
            int rowCount = 0;
            DateTime tungay = Convert.ToDateTime(txttungay.Text);
            DateTime denngay = Convert.ToDateTime(txtdenngay.Text);
            Repeater1.DataSource = vResultLotteryBL.SelectAll_KQ_Thongke(thongke, ddltinhthanh.SelectedValue, tungay, denngay);
            Repeater1.DataBind();
            Page.MaintainScrollPositionOnPostBack = true;
        }
    }
}